package br.com.servlet.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import br.com.model.dao.DAO;
import br.com.model.dao.DAOFactory;
import br.com.model.dao.Tabelas;

@Controller
public class DataBaseController 
{
	@RequestMapping("/base-manager-games-clean")
	public String baseManager( Model model )
	{
		DAO infGameDao = DAOFactory.infDao( );
		
		if( infGameDao.removeAll( Tabelas.GAME ) )
		{
			model.addAttribute( "msg", "Todos os Games foram deletados!" );
		}
		else
		{
			model.addAttribute( "msg", "Erro ao deletar os Games!" );
		}
		
		return "base/manager";
	}
}